package com.kexio.enterprise.integration.notification.result;

import com.kexio.enterprise.integration.notification.enums.NotificationChannel;
import com.kexio.enterprise.integration.notification.enums.NotificationStatus;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * 通知发送结果
 * 
 * @author Kexio
 * @since 1.0.0
 */
public class NotificationResult {
    private boolean success;
    private String notificationId;
    private NotificationStatus status;
    private List<NotificationChannel> sentChannels;
    private List<NotificationChannel> failedChannels;
    private Map<NotificationChannel, String> channelResults;
    private int totalRecipients;
    private int successfulRecipients;
    private int failedRecipients;
    private String errorMessage;
    private LocalDateTime sendTime;
    private long processingTime;
    private Map<String, Object> metadata;

    public NotificationResult() {
        this.sendTime = LocalDateTime.now();
    }

    public NotificationResult(boolean success, String notificationId) {
        this();
        this.success = success;
        this.notificationId = notificationId;
        this.status = success ? NotificationStatus.SENT : NotificationStatus.FAILED;
    }

    // Getters and Setters
    public boolean isSuccess() { return success; }
    public void setSuccess(boolean success) { this.success = success; }
    
    public String getNotificationId() { return notificationId; }
    public void setNotificationId(String notificationId) { this.notificationId = notificationId; }
    
    public NotificationStatus getStatus() { return status; }
    public void setStatus(NotificationStatus status) { this.status = status; }
    
    public List<NotificationChannel> getSentChannels() { return sentChannels; }
    public void setSentChannels(List<NotificationChannel> sentChannels) { this.sentChannels = sentChannels; }
    
    public List<NotificationChannel> getFailedChannels() { return failedChannels; }
    public void setFailedChannels(List<NotificationChannel> failedChannels) { this.failedChannels = failedChannels; }
    
    public Map<NotificationChannel, String> getChannelResults() { return channelResults; }
    public void setChannelResults(Map<NotificationChannel, String> channelResults) { this.channelResults = channelResults; }
    
    public int getTotalRecipients() { return totalRecipients; }
    public void setTotalRecipients(int totalRecipients) { this.totalRecipients = totalRecipients; }
    
    public int getSuccessfulRecipients() { return successfulRecipients; }
    public void setSuccessfulRecipients(int successfulRecipients) { this.successfulRecipients = successfulRecipients; }
    
    public int getFailedRecipients() { return failedRecipients; }
    public void setFailedRecipients(int failedRecipients) { this.failedRecipients = failedRecipients; }
    
    public String getErrorMessage() { return errorMessage; }
    public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; }
    
    public LocalDateTime getSendTime() { return sendTime; }
    public void setSendTime(LocalDateTime sendTime) { this.sendTime = sendTime; }
    
    public long getProcessingTime() { return processingTime; }
    public void setProcessingTime(long processingTime) { this.processingTime = processingTime; }
    
    public Map<String, Object> getMetadata() { return metadata; }
    public void setMetadata(Map<String, Object> metadata) { this.metadata = metadata; }
}
